using System;
using ProdControls.Bridges;
using ProdControls.Interfaces;
using ProdLogging;

namespace ProdControls
{
    /// <summary>
    ///   Methods to work with Spinner (or numeric up/down) controls using the UI Automation framework
    ///   A Spinner control type consists of a set of buttons that enable a user to select from a set of items or set a numerical value from within a range
    /// </summary>
    public sealed class ProdSpinner : BaseProdControl, IRangeValue
    {
        #region Constructors

        /// <summary>
        ///   Initializes a new instance of the ProdSlider class.
        /// </summary>
        /// <param name="prodWindow"> The ProdWindow that contains this control. </param>
        /// <param name="automationId"> The UI Automation element </param>
        /// <remarks>
        ///   Will attempt to match AutomationId, then ReadOnly
        /// </remarks>
        public ProdSpinner(ProdWindow prodWindow, string automationId)
            : base(prodWindow, automationId)
        {
        }

        /// <summary>
        ///   Initializes a new instance of the ProdSlider class.
        /// </summary>
        /// <param name="prodWindow"> The ProdWindow that contains this control. </param>
        /// <param name="treePosition"> The index of this control in the parent windows UI control tree. </param>
        public ProdSpinner(ProdWindow prodWindow, int treePosition)
            : base(prodWindow, treePosition)
        {
        }

        /// <summary>
        ///   Initializes a new instance of the ProdSlider class.
        /// </summary>
        /// <param name="controlHandle"> Window handle of the control </param>
        public ProdSpinner(IntPtr controlHandle)
            : base(controlHandle)
        {
        }

        #endregion Constructors

        #region IRangeValue Members

        /// <summary>
        ///   Gets the maximum value of the control
        /// </summary>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public double Maximum
        {
            get { return this.GetMaxValueHook(this); }
        }

        /// <summary>
        ///   Gets the minimum value of the control
        /// </summary>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public double Minimum
        {
            get { return this.GetMinValueHook(this); }
        }

        /// <summary>
        ///   Gets or sets the value.
        /// </summary>
        /// <value> The desired value. </value>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public double Value
        {
            get { return this.GetValueHook(this); }
            set { this.SetValueHook(this, value); }
        }

        /// <summary>
        ///   Gets a value indicating whether this instance is read only.
        /// </summary>
        /// <value> <c>true</c> if this instance is read only; otherwise, <c>false</c> . </value>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public bool IsReadOnly
        {
            get { return this.IsReadOnlyHook(this); }
        }

        /// <summary>
        ///   Gets the control-specific large-change value which is added to or subtracted from the Value property.
        /// </summary>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public double LargeChange
        {
            get { return this.GetLargeChangeHook(this); }
        }

        /// <summary>
        ///   Gets the control-specific small-change value which is added to or subtracted from the Value property.
        /// </summary>
        [ProdLogging(LoggingLevels.Prod, VerbositySupport = LoggingVerbosity.Minimum)]
        public double SmallChange
        {
            get { return this.GetSmallChangeHook(this); }
        }

        #endregion
    }
}